/**
 *
 * MobileLib   
 * AboutActivity.java
 * Dec 29, 2011
 * @author qidiven
 *
 */
package com.ustc.mobilelib.view;

import com.ustc.diven.model.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;

public class AboutActivity extends Activity{
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		if(event.getKeyCode() == KeyEvent.KEYCODE_BACK)
		{
			logoutDialog();
		}
		return super.onKeyDown(keyCode, event);
	}
	
	private void logoutDialog() {
		AlertDialog.Builder builder = new Builder(AboutActivity.this);
//		builder.setMessage(getString(R.string.logout_confirm));
		builder.setIcon(R.drawable.logo);
		builder.setTitle(getString(R.string.logout_confirm));
		builder.setCancelable(false);
		
		builder.setPositiveButton(getString(R.string.confirm), new OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
//				MyLibActivity.this.finish();
				android.os.Process.killProcess(android.os.Process.myPid());
			}
		});
		
		builder.setNegativeButton(getString(R.string.cancel), new OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		builder.create().show();
	}

	private static final String TAG = AboutActivity.class.toString();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.about);
		init();
	}
	
	private void init()
	{
		this.getWindow().setBackgroundDrawableResource(R.color.loading_bg);
	}
	
}
